package com.mioto.ld.communication.mqtt.protocol;

import com.mioto.ld.communication.DeviceOfflineProcess;
import com.mioto.ld.communication.mqtt.protocol.model.Message;
import com.mioto.ld.utils.SpringBeanUtil;
import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.Executor;

/**
 * @author mioto-qinxj
 * @date 2024/5/25
 * @desc 设备离线处理
 */
@Slf4j
public class WillHandleStrategy implements IReceiptHandleStrategy {

    private DeviceOfflineProcess deviceOfflineProcess;

    public WillHandleStrategy(){
        deviceOfflineProcess = SpringBeanUtil.getBean(DeviceOfflineProcess.class);
    }

    @Override
    public void protocolHandler(Message message)  throws Exception{
        log.info("=============receive device will message=============");
        deviceOfflineProcess.handler(message,true);
    }
}
